<html>
<head><meta charset="utf-8"><title>conflicting impls · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html">conflicting impls</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239302522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239302522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239302522">(May 18 2021 at 18:27)</a>:</h4>
<p>do we have a way to silence this warning for types in <code>core</code>/<code>std</code>?</p>



<a name="239302527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239302527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239302527">(May 18 2021 at 18:27)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error[E0119]: conflicting implementations of trait `core::convert::From&lt;&amp;str&gt;` for type `boxed::Box&lt;dyn core::error::Error + core::marker::Send + core::marker::Sync&gt;`:
    --&gt; library/alloc/src/boxed.rs:1807:1
     |
1705 | impl&lt;&#39;a, E: Error + Send + Sync + &#39;a&gt; From&lt;E&gt; for Box&lt;dyn Error + Send + Sync + &#39;a&gt; {
     | ----------------------------------------------------------------------------------- first implementation here
...
1807 | impl&lt;&#39;a&gt; From&lt;&amp;str&gt; for Box&lt;dyn Error + Send + Sync + &#39;a&gt; {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `boxed::Box&lt;dyn core::error::Error + core::marker::Send + core::marker::Sync&gt;`
     |
     = note: upstream crates may add a new impl of trait `core::error::Error` for type `str` in future versions
</code></pre></div>



<a name="239302664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239302664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239302664">(May 18 2021 at 18:28)</a>:</h4>
<p>I had expected the <code>downcast</code> method to be the real exciting part but From&lt;&amp;str&gt; for Box&lt;dyn Error&gt; is really putting in work (causing problems)</p>



<a name="239303344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239303344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239303344">(May 18 2021 at 18:32)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span> it's not a warning, but <code>#[fundamental]</code> should work</p>



<a name="239303683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239303683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239303683">(May 18 2021 at 18:34)</a>:</h4>
<p>uh, well, that is likely not what you want, even if it removes the error. in this case it looks like you're trying to specialize the from impl for a specific type? I think usually we do that via something like spec_extend on Vec, see e.g. <a href="https://github.com/rust-lang/rust/blob/master/library/alloc/src/vec/spec_extend.rs#L8">https://github.com/rust-lang/rust/blob/master/library/alloc/src/vec/spec_extend.rs#L8</a></p>



<a name="239303753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239303753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239303753">(May 18 2021 at 18:34)</a>:</h4>
<p>which is used <a href="https://github.com/rust-lang/rust/blob/master/library/alloc/src/vec/mod.rs#L2519">https://github.com/rust-lang/rust/blob/master/library/alloc/src/vec/mod.rs#L2519</a></p>



<a name="239313762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239313762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239313762">(May 18 2021 at 19:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/conflicting.20impls/near/239303683">said</a>:</p>
<blockquote>
<p>uh, well, that is likely not what you want, even if it removes the error. in this case it looks like you're trying to specialize the from impl for a specific type? I think usually we do that via something like spec_extend on Vec, see e.g. <a href="https://github.com/rust-lang/rust/blob/master/library/alloc/src/vec/spec_extend.rs#L8">https://github.com/rust-lang/rust/blob/master/library/alloc/src/vec/spec_extend.rs#L8</a></p>
</blockquote>
<p>I don't think that helps because the overlapping impl isn't one that actually overlaps, it's one that potentially overlaps, the issue being that <code>&amp;str</code> _might_ implement <code>Error</code> in the future</p>



<a name="239313891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239313891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239313891">(May 18 2021 at 19:42)</a>:</h4>
<p>and we're never going to implement <code>Error</code> for <code>&amp;str</code> so we can't just lean on the <code>From&lt;E&gt;</code> impl for Box and specialize it internally</p>



<a name="239313900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239313900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239313900">(May 18 2021 at 19:42)</a>:</h4>
<p>oh, oh</p>



<a name="239313923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239313923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239313923">(May 18 2021 at 19:43)</a>:</h4>
<p>you might be able to impl !error for &amp;str, i'm not sure that will help though</p>



<a name="239313972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239313972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239313972">(May 18 2021 at 19:43)</a>:</h4>
<p>I know the support in theory exists for some pin shenanigans, but not sure it carried through to trait solving/coherence; <span class="user-mention" data-user-id="116009">@nikomatsakis</span> might remember.</p>



<a name="239314518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239314518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239314518">(May 18 2021 at 19:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/conflicting.20impls/near/239313923">said</a>:</p>
<blockquote>
<p>you might be able to impl !error for &amp;str, i'm not sure that will help though</p>
</blockquote>
<p>that doesn't seem to help</p>



<a name="239314857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239314857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239314857">(May 18 2021 at 19:49)</a>:</h4>
<p>yeah, I think the support for coherence using that info isn't implemented then</p>



<a name="239314885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239314885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239314885">(May 18 2021 at 19:49)</a>:</h4>
<p>it's probably not <em>too</em> hard, but still work.</p>



<a name="239314891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239314891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239314891">(May 18 2021 at 19:49)</a>:</h4>
<p>yea</p>



<a name="239314962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239314962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239314962">(May 18 2021 at 19:50)</a>:</h4>
<p>I think that's a hard blocker on <code>Error</code> in <code>core</code></p>



<a name="239315098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239315098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239315098">(May 18 2021 at 19:51)</a>:</h4>
<p>so I should probably touch base with niko or whoever to confirm that using negative impls is the right path forward and to get an idea of how to implement the missing logic</p>



<a name="239315483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239315483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239315483">(May 18 2021 at 19:54)</a>:</h4>
<p>I'd suspect it is not the wrong path, at least, given we'd not necessarily need to stabilize them and seem intuitive enough</p>



<a name="239315888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239315888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239315888">(May 18 2021 at 19:57)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/68004">https://github.com/rust-lang/rust/pull/68004</a></p>



<a name="239315930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239315930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239315930">(May 18 2021 at 19:57)</a>:</h4>
<p>specifically calls out how negative impls aren't considered for coherence</p>



<a name="239316096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239316096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239316096">(May 18 2021 at 19:58)</a>:</h4>
<p>Conceptually I really like it and especially I think a negative impl is way cleaner than the existing hack of doing things like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// from library/core/src/ops/function.rs</span>
<span class="cp">#[fundamental]</span><span class="w"> </span><span class="c1">// so that regex can rely that `&amp;str: !FnMut`</span>
<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="nb">FnOnce</span><span class="o">&lt;</span><span class="n">Args</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</code></pre></div>



<a name="239316167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239316167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239316167">(May 18 2021 at 19:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/131828-t-compiler/topic/conflicting.20impls/near/239315930">said</a>:</p>
<blockquote>
<p>specifically calls out how negative impls aren't considered for coherence</p>
</blockquote>
<p>unless I'm forgetting/missing it now, it just doesn't implement it, not that there's a reason it couldn't happen</p>



<a name="239316181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239316181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239316181">(May 18 2021 at 19:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/131828-t-compiler/topic/conflicting.20impls/near/239315930">said</a>:</p>
<blockquote>
<p>specifically calls out how negative impls aren't considered for coherence</p>
</blockquote>
<p>But it also says</p>
<blockquote>
<p>It should eventually mean that you can rely on the impl not existing for the purposes of negative reasoning in coherence, though this PR doesn't implement that.</p>
</blockquote>



<a name="239316382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239316382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239316382">(May 18 2021 at 20:00)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/coherence.rs#L247">https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/coherence.rs#L247</a> I think is roughly where such an impl would go, though I'm no expert</p>



<a name="239317263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239317263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239317263">(May 18 2021 at 20:05)</a>:</h4>
<p>I just remember being told that negative impls somehow negatively impacting the trait solver</p>



<a name="239317295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239317295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239317295">(May 18 2021 at 20:05)</a>:</h4>
<p>something about changing it from a closed set to an open set</p>



<a name="239317376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239317376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239317376">(May 18 2021 at 20:06)</a>:</h4>
<p>so i've been pretty careful to avoid any changes relying on negative impls</p>



<a name="239317967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239317967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239317967">(May 18 2021 at 20:10)</a>:</h4>
<p><em>in general</em> I think e.g. inference would be hard to make rely on this</p>



<a name="239317989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239317989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239317989">(May 18 2021 at 20:10)</a>:</h4>
<p>but from what I know, which is not much, I suspect that coherence in particular is the 'easy' thing here.</p>



<a name="239318875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239318875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239318875">(May 18 2021 at 20:16)</a>:</h4>
<p>Yeah, my recollection is that the critical thing to avoid is things like <code>impl Copy for Foo where Bar: !Copy</code>.</p>
<p>You might be able to look at how <code>#[marker]</code> (feature <code>marker_trait_attr</code>) works, since that's also about changing overlap restrictions.</p>



<a name="239319551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239319551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239319551">(May 18 2021 at 20:21)</a>:</h4>
<p>aaah</p>



<a name="239326693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239326693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239326693">(May 18 2021 at 21:11)</a>:</h4>
<p>Hmm, though if one is in core and one is in alloc then it's a "real" coherence question, not just a same-crate overlap one, so it might be slightly more complicated.</p>



<a name="239327062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239327062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239327062">(May 18 2021 at 21:13)</a>:</h4>
<p>(Of course, you also don't need a perfect implementations -- something feature-gated that's good enough to turn on for alloc is sufficient <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span>)</p>



<a name="239375172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375172">(May 19 2021 at 06:55)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span> So---</p>



<a name="239375180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375180">(May 19 2021 at 06:55)</a>:</h4>
<p>we don't have "proper" support for negative impls <em>but</em></p>



<a name="239375193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375193">(May 19 2021 at 06:55)</a>:</h4>
<p>that is a feature I have been wanting to pursue</p>



<a name="239375211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375211">(May 19 2021 at 06:55)</a>:</h4>
<p>I would be up for working with you if you wanted to make it happen</p>



<a name="239375229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375229">(May 19 2021 at 06:55)</a>:</h4>
<p>Yes</p>



<a name="239375235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375235">(May 19 2021 at 06:55)</a>:</h4>
<p>specifically what I mean is:</p>



<a name="239375240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375240">(May 19 2021 at 06:55)</a>:</h4>
<ul>
<li>you are able to declare a negative impl</li>
</ul>



<a name="239375253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375253">(May 19 2021 at 06:55)</a>:</h4>
<p>I will probably spend Friday working on this</p>



<a name="239375255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375255">(May 19 2021 at 06:56)</a>:</h4>
<ul>
<li>coherence takes it account</li>
</ul>



<a name="239375308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375308">(May 19 2021 at 06:56)</a>:</h4>
<ul>
<li>there are no negative where clauses</li>
</ul>



<a name="239375336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375336">(May 19 2021 at 06:56)</a>:</h4>
<p>we might at some point consider adding negative where clauses, there are variants that are ok and variants that are problematic</p>



<a name="239375347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375347">(May 19 2021 at 06:56)</a>:</h4>
<p>but I don't think they are as useful as saying "I promise I will never implement that"</p>



<a name="239375395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375395">(May 19 2021 at 06:57)</a>:</h4>
<p>Makes sense</p>



<a name="239375530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375530">(May 19 2021 at 06:58)</a>:</h4>
<p>I think we would eventually need an RFC, but we could start by creating a quick 'project' and fleshing out the ideas</p>



<a name="239375582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239375582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239375582">(May 19 2021 at 06:59)</a>:</h4>
<p>I'm trying to remember if/when I've written out my thinking on this :)</p>



<a name="239624147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239624147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239624147">(May 20 2021 at 16:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/131828-t-compiler/topic/conflicting.20impls/near/239375582">said</a>:</p>
<blockquote>
<p>I'm trying to remember if/when I've written out my thinking on this :)</p>
</blockquote>
<p>did you manage to find your past posts about this?</p>



<a name="239630636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239630636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239630636">(May 20 2021 at 17:36)</a>:</h4>
<p>some thinking here - <a href="https://internals.rust-lang.org/t/explicit-negative-impls-to-fix-pin-soundness-hole/11587">https://internals.rust-lang.org/t/explicit-negative-impls-to-fix-pin-soundness-hole/11587</a></p>



<a name="239816156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239816156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239816156">(May 21 2021 at 21:39)</a>:</h4>
<blockquote>
<p>In terms of going forward, e.g. creating interactions with coherence, I think it's important to base this work on Chalk -- in particular, on Chalk's definition of the trait system in terms of a "lowering" to logical predicates. I was thinking that it would be good to write-up the existing work we've done on handling coherence and then try to frame negative impls in that context.</p>
</blockquote>



<a name="239816170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239816170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239816170">(May 21 2021 at 21:39)</a>:</h4>
<p>just to double check <span class="user-mention" data-user-id="116009">@nikomatsakis</span> , is this comment you made in the pin thread back in jan 2020 still accurate?</p>



<a name="239816229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239816229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239816229">(May 21 2021 at 21:40)</a>:</h4>
<p>reading through the rustc dev guide on trait selection and familiarizing myself with how the code works before I start working on the impl, but I haven't gotten to the section on chalk yet and don't otherwise know how well integrated it is with rustc atm.</p>



<a name="239829932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239829932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239829932">(May 22 2021 at 00:34)</a>:</h4>
<p>I think that comment is still accurate</p>



<a name="239830038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/239830038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#239830038">(May 22 2021 at 00:36)</a>:</h4>
<p>It's not so much the integration itself, but moreso how we think about rust features in a more fundamental logic system, in this case Chalk's predicates</p>



<a name="240069836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240069836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240069836">(May 24 2021 at 15:48)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span> seems accurate, I'd be up to work with you around that</p>



<a name="240091185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091185">(May 24 2021 at 18:27)</a>:</h4>
<p>sounds good, I'll bother you tomorrow when I'm working on this again if I find the time, might have to be delayed until friday though</p>



<a name="240091229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091229">(May 24 2021 at 18:27)</a>:</h4>
<p>or i guess, more accurately I'll be in touch if I have questions when I'm working on this</p>



<a name="240091380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091380">(May 24 2021 at 18:28)</a>:</h4>
<p>if you have time and want to write up a brief explanation of how you expect the implementation to look mentorship instruction style that might save a bit of time</p>



<a name="240091489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091489">(May 24 2021 at 18:29)</a>:</h4>
<p>my plan atm is to figure out where negative impls are currently tracked in the compiler, then explore the APIs available inside the <code>trait_is_knowable</code> or w/e its called function that mark linked earlier</p>



<a name="240091525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091525">(May 24 2021 at 18:30)</a>:</h4>
<p>to see if any of them already intersect with the parts of the compiler that already track negative impls</p>



<a name="240091631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091631">(May 24 2021 at 18:30)</a>:</h4>
<p>and assuming they aren't connected I expect I'll need to use chalk to record/expose/query the info in the aforementioned function</p>



<a name="240091762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240091762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240091762">(May 24 2021 at 18:31)</a>:</h4>
<p>and I'm hoping that the chalk section in the rustc dev guide gives me enough info about how to use chalk to help me figure out how to use it here</p>



<a name="240529510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240529510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240529510">(May 27 2021 at 20:50)</a>:</h4>
<p>what does it mean for a trait to be "knowable"?</p>



<a name="240537919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240537919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240537919">(May 27 2021 at 22:01)</a>:</h4>
<p>decided to push my first pass implementation that doesn't work at all in case someone can quickly identify the problem for me, in the mean time I'm still reading and trying to figure out how to do this properly.</p>



<a name="240537923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240537923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240537923">(May 27 2021 at 22:01)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/85764">https://github.com/rust-lang/rust/pull/85764</a></p>



<a name="240541153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/conflicting%20impls/near/240541153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/conflicting.20impls.html#240541153">(May 27 2021 at 22:41)</a>:</h4>
<p>pretty sure this is because I tried looking up the polarity of a traitref on accident, but I need to look it up on a trait impl instead</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>